<?php
namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Activity extends Model
{

    protected $table = 'activity';

    public $timestamps = false;


    public function coupon()
    {
        return $this->hasManyThrough(
            Coupon::class, //远程表
            ActivityCoupon::class, //中间表
            'activity_id', //中间表对应主表关联字段
            'id', //远程表对应中间表关联字段
            'id', //主表对中间表关联字段
            'coupon_id' //中间表对应远程表关联字段
        )->where('status', 1);
    }


}
